home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / AppsToGo / DTS.Draw / TreeObj2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-22  |  2.5 KB  |  110 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        TreeObj2.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1992-1993 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  20. #include "App.protos.h"        /* Get the prototypes for the application.        */
  21.  
  22. #ifndef __TREEOBJ2__
  23. #include "TreeObj2.h"
  24. #endif
  25.  
  26. extern TreeObjProcPtr    gTreeObjMethods[];
  27.  
  28.  
  29.  
  30. /*****************************************************************************/
  31. /*****************************************************************************/
  32.  
  33. #ifdef applec
  34. #pragma segment DTSDrawSeg2
  35. #endif
  36.  
  37. /*****************************************************************************/
  38. /*****************************************************************************/
  39.  
  40.  
  41.  
  42. TreeObjHndl    DoTreeHitTest(TreeObjHndl hndl, ClickInfo *click)
  43. {
  44.     short        cnum;
  45.     TreeObjHndl    hit;
  46.  
  47.     hit = (TreeObjHndl)DoTreeObjMethod(hndl, HITTESTMESSAGE, (long)click);
  48.     if (hit) return(hit);
  49.  
  50.     for (cnum = 0; cnum < (*hndl)->numChildren; ++cnum) {
  51.         hit = DoTreeHitTest(GetChildHndl(hndl, cnum), click);
  52.         if (hit) return(hit);
  53.     }
  54.  
  55.     return(nil);
  56. }
  57.  
  58.  
  59.  
  60. /**********************************************************************/
  61.  
  62.  
  63.  
  64. void    DoTreeDraw(TreeObjHndl hndl, short drawType)
  65. {
  66.     DoBTreeMethod(hndl, DRAWMESSAGE, drawType);
  67. }
  68.  
  69.  
  70.  
  71. /**********************************************************************/
  72.  
  73.  
  74.  
  75. void    DoTreeSelect(TreeObjHndl hndl, short selectType)
  76. {
  77.     FileRecHndl    frHndl;
  78.     WindowPtr    window;
  79.  
  80.     frHndl = mDerefRoot(GetRootHndl(hndl))->frHndl;
  81.     BeginContent(window = (*frHndl)->fileState.window);
  82.     DoFTreeMethod(hndl, SETSELECTMESSAGE, selectType);
  83.     EndContent(window);
  84. }
  85.  
  86.  
  87.  
  88. /**********************************************************************/
  89.  
  90.  
  91.  
  92. long    DoTreeObjMethodClipped(TreeObjHndl hndl, short message, long data)
  93. {
  94.     FileRecHndl    frHndl;
  95.     WindowPtr    window;
  96.     long        val;
  97.  
  98.     frHndl = mDerefRoot(GetRootHndl(hndl))->frHndl;
  99.     BeginContent(window = (*frHndl)->fileState.window);
  100.  
  101.     val = DoTreeObjMethod(hndl, message, data);
  102.  
  103.     EndContent(window);
  104.  
  105.     return(val);
  106. }
  107.  
  108.  
  109.  
  110.